package com.simple.deploy.config;

import com.github.benmanes.caffeine.cache.Cache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author pan.shun
 * @since 2022/3/15 17:18
 */
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private RestTemplate restTemplate;

    @Value("${simple-label-core-url:null}")
    private String requestUrl;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(new AdminInterceptor(restTemplate, requestUrl));
        registration.addPathPatterns("/**");
        registration.excludePathPatterns();
    }
}
